package com.aviccxzx.smarthome.UserModule;

import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.aviccxzx.smarthome.R;
import com.aviccxzx.smarthome.base.GosUserModuleBaseActivity;


/**
 * Created by joey on 2016/10/25.
 */
public class AddFailActivity extends GosUserModuleBaseActivity implements View.OnClickListener {

    public static AddFailActivity addDeviFailInstance = null;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            setContentView(R.layout.add_fail_lay_v19);
        }else {
        }
        addDeviFailInstance = this;
        ((TextView) findViewById(R.id.title_tv)).setText("添加失败");

        boolean bind_fail = getIntent().getBooleanExtra("bind",false);
        boolean isFromGate = getIntent().getBooleanExtra("gateway",false);
        if (bind_fail){
            //绑定失败 已经有管理员
            findViewById(R.id.bind_fail).setVisibility(View.VISIBLE);
        }
        if(isFromGate){
            //如果是来自网关的添加失败 就隐藏温馨提示内容
            findViewById(R.id.add_device_hint).setVisibility(View.GONE);
        }
        findViewById(R.id.ll_title_left_view).setOnClickListener(this);
        findViewById(R.id.try_btn).setOnClickListener(this);
        findViewById(R.id.sure_btn).setOnClickListener(this);
    }


    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.ll_title_left_view:
                finish();
                break;
            case R.id.try_btn:
                finish();
                break;
            case R.id.sure_btn:
                finish();
                break;
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        addDeviFailInstance = null;
    }
}
